{template 'common/header'}
<ul class="nav nav-tabs">
	<li {if $do  == 'stat'} class="active"{/if}><a href="{php echo url('mc/creditmanage/stat', array('type' => 1, 'uid' => $uid));}">数据概况</a></li>
	{loop $creditnames $index $creditname}
		{if $creditname['title'] != '***'}
			<li {if $do  == 'credit_record' &&  $type == $index} class="active"{/if}><a href="{php echo url('mc/creditmanage/credit_record', array('type' => $index, 'uid' => $uid));}">{$creditname['title']}日志</a></li>
		{/if}
	{/loop}
</ul>
{if $do  == 'credit_record'}
<div class="panel panel-default">
	<div class=" panel-body table-responsive">
		<table class="table table-hover">
			<thead>
				<tr>
					<th style="width:100px">积分类型</th>
					<th style="width:100px">操作员</th>
					<th style="width:100px">积分数量</th>
					<th style="width:200px">操作时间</th>
					<th>备注</th>
				</tr>
			</thead>
			<tbody>
				{loop $data $da}
					<tr>
						<td>{$creditnames[$type]['title']}</td>
						<td>{if $da['username']}{$da['username']}{else}本人{/if}</td>	
						<td>{$da['num']}</td>
						<td>{php echo date('Y-m-d H:i:s', $da['createtime'])}</td>	
						<td>{$da['remark']}</td>
					</tr>
				{/loop}
			</tbody>
		</table>
	</div>
</div>
{$pager}
{elseif $do == 'stat'}
<style>
	.account-stat{overflow:hidden; color:#666;}
	.account-stat .account-stat-btn{width:100%; overflow:hidden;}
	.account-stat .account-stat-btn > div{text-align:center; margin-bottom:5px;margin-right:2%; float:left;width:18%; padding-top:10px;font-size:16px; border-left:1px #DDD solid;}
	.account-stat .account-stat-btn > div:first-child{border-left:0;}
	.account-stat .account-stat-btn .stat{width:80%;margin:10px auto;font-size:15px}
</style>
<div class="panel panel-default" style="padding:1em">
	<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin: -1em -1em 1em -1em;">
		<div class="navbar-header">
			<a class="navbar-brand" href="javascript:;">数据统计</a>
			<ul class="nav navbar-nav navbar-right">
				<li {if $_GPC['type'] == 1}class="active"{/if}><a href="{php echo url('mc/creditmanage/stat', array('uid' => $uid, type => 1));}">今日</a></li>
				<li {if $_GPC['type'] == -1}class="active"{/if}><a href="{php echo url('mc/creditmanage/stat', array('uid' => $uid, type => -1));}">昨日</a></li>
				<form class="navbar-form navbar-left" role="search" id="form1">
					<input name="c" value="mc" type="hidden" />
					<input name="a" value="creditmanage" type="hidden" />
					<input name="do" value="stat" type="hidden" />
					<input name="uid" value="{$uid}" type="hidden" />

					{php echo tpl_form_field_daterange('datelimit', array('start' => date('Y-m-d', $starttime),'end' => date('Y-m-d', $endtime)), '')}
				</form>
			</ul>
		</div>
	</nav>
	<div class="account-stat">
		<div class="account-stat-btn">
			{loop $creditnames $key $li}
				<div>
					<strong>{$li['title']}</strong>
					<div id="rule" class="stat">
						<div>增加 <strong><span class="text-success">{$data[$key]['add']}</span></strong></div>
						<div>减少 <strong><span class="text-danger">{$data[$key]['del']}</span></strong></div>
					</div>
				</div>
			{/loop}
		</div>
	</div>
</div>
<script>
	require(['chart', 'jquery', 'daterangepicker'], function(c, $) {
		$('.daterange').on('apply.daterangepicker', function(ev, picker) {
			$('#form1')[0].submit();
		});
	});
</script>
{/if}
{template 'common/footer'}